package stackdemon;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 21626
 * Date: 2024-10-27
 * Time: 0:11
 */
public class test6 {
    public static void main(String[] args) {
        MyStack myStack = new MyStack();
        myStack.push(12);//填充进去元素
        myStack.push(23);
        myStack.push(34);
        myStack.push(45);
        //pop弹出的是栈顶的元素，同时删去
        System.out.println(myStack.pop());
        //peek弹出不删除
        System.out.println(myStack.peek());
        System.out.println(myStack.peek());

    }
    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(12);//填充进去元素
        stack.push(23);
        stack.push(34);
        stack.push(45);
        //pop弹出的是栈顶的元素，同时删去
        System.out.println(stack.pop());
        //peek弹出不删除
        System.out.println(stack.peek());
        System.out.println(stack.peek());

    }
}
